﻿using System;

class PrimeFactorization
{

    public static int GetInput()
    {
        Console.WriteLine("请输入一个正整数：");
        int number;
        while (!int.TryParse(Console.ReadLine(), out number) || number <= 1)
        {
            Console.WriteLine("输入无效，请输入一个大于1的正整数：");
        }
        return number;
    }

    public static void PrintPrimeFactors(int number, int[] primeFactors)
    {
        Console.WriteLine($"数字 {number} 的所有素数因子如下：");
        foreach (int factor in primeFactors)
        {
            Console.WriteLine(factor);
        }
    }

  
    public static void FindPrimeFactors(int number, List<int> primeFactorsList)
    {
        while (number % 2 == 0)
        {
            primeFactorsList.Add(2);
            number /= 2;
        }

        for (int i = 3; i <= Math.Sqrt(number); i += 2)
        {
            while (number % i == 0)
            {
                primeFactorsList.Add(i);
                number /= i;
            }
        }

        if (number > 2)
        {
            primeFactorsList.Add(number);
        }
    }
}

class Program01
{
    static void Main()
    {
        int number = PrimeFactorization.GetInput();
        List<int> primeFactorsList = new List<int>();
        PrimeFactorization.FindPrimeFactors(number, primeFactorsList);
        PrimeFactorization.PrintPrimeFactors(number, primeFactorsList.ToArray());
    }
}